package com.linkhouse.controller;

import com.linkhouse.common.data.Result;
import com.linkhouse.service.QueryOrederService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@RequestMapping("/alipay")
@RestController
@Api("租房订单接口文档")
public class AddOrderController {

    @Autowired
    private QueryOrederService AlipayService;

    /*
    * 首组,增加订单
    *
    * */

    @PostMapping("addOrder")
    @ApiOperation(value = "增加订单")
    @ApiImplicitParams({

            @ApiImplicitParam(name = "areaId",value = "小区Id",required = false,paramType = "query"),
            @ApiImplicitParam(name = "price",value = "订单金额",required = false,paramType = "query"),
            @ApiImplicitParam(name = "month",value = "租房月数",required = false,paramType = "query"),
            @ApiImplicitParam(name = "deposit",value = "押金",required = false,paramType = "query"),

    })                                    //可以不必填
    public Result addOrder(@RequestParam Long areaId ,@RequestParam Double deposit
            ,@RequestParam Double price,@RequestParam Integer month){

        AlipayService.insert(areaId,price,month,deposit);
        return Result.OK();
    }




}
